package com.nhjf.admin.util;



/**
 * 接口返回对象。
 * @author liwei
 */
public class JsonResult {

	public static final String SUCESS = "0";
	public static final String SYSTEM_ERROR_400 = "400";
	public static final String SYSTEM_ERROR_500 = "500";
	public static final String SYSTEM_ERROR_MESSAGE = "系统错误。";

	private String code = SUCESS;
	private String message;

	public JsonResult() {
	}

	public JsonResult(String code, String message) {
		this.code = code;
		this.message = message;
	}

	/**
	 * 创建结果.
	 */
	public void setError(String code, String message) {
		this.code = code;
		this.message = message;
	}

	/**
	 * 创建默认异常结果.
	 */
	public void setDefaultError() {
		setError(SYSTEM_ERROR_400, SYSTEM_ERROR_MESSAGE);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	@Override
	public String toString() {
		return ": code = " + code + ", message = " + message;
	}
}